﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DBWTProject.persistence;
using System.Data.SqlClient;
using System.Diagnostics;
using DBWTProject.models;

namespace DBWTProject
{
    public partial class _Default : System.Web.UI.Page
    {
        //Nur zur Entwicklungszeit
        static bool debugFirstVisit = true;

        protected void Page_Load(object sender, EventArgs e)
        {
            //Damit das Testen während der Entwicklung schneller geht -> immer manuell einloggen
            debugLogin();

            User user = (User) Session[Constants.SESSIONVAR_CURRENTUSER];
            if (user != null){
                hylLogin.Visible = false;
            }

                
        }

        private void debugLogin()
        {
            if (debugFirstVisit)//damit man sich überhaupt zu testzwecken ausloggen kann
            {

            Session[Constants.SESSIONVAR_CURRENTUSER] = new User()
            {
                ID = 1,
                Name = "paul",
                FullName = "Paul Pilsener",
                Password = "3c9909afec25354d551dae21590bb26e38d53f2173b8d3dc3eee4c047e7ab1c1eb8b85103e3be7ba613b31bb5c9c36214dc9f14a42fd7a2fdb84856bca5c44c2"//123
            };
            }
            debugFirstVisit = false;
        }
    }
}
